<template>
	<view class="j-w-me">
		<view class="user-header">
			<view class="user-header-img">
				<u-image src="@/static/image/logo3.png" shape="circle" mode="" width="80rpx" height="80rpx"></u-image>
			</view>
			<view class="j-w-user-nickname">{{userInfo.username || '小鲸洗用户'}}</view>

		</view>

		<view class="j-w-order">
			<view class="j-w-card">
				<view class="j-w-card-nav">
					<view class="j-w-card-title">全部订单</view>
					<view class="j-w-card-jump" @click="toMeOrder(0)">
						查看全部订单
						<text class="hxf hxf-youbian"></text>
					</view>
				</view>

				<view class="j-w-card-content">
					<view class="j-w-card-column" @click="toMeOrder(0)">
						<view class="j-w-card-column-top">
							<view class="j-w-card-column-top-img">
								<image src="../../static/image/j-m-o-1.png"></image>
							</view>
						</view>
						<view class="j-w-card-column-bottom">全部订单</view>
					</view>

					<view class="j-w-card-column" @click="toMeOrder(1)">
						<view class="j-w-card-column-top">
							<view class="j-w-card-column-top-img">
								<image src="../../static/image/j-m-o-3.png"></image>
							</view>
						</view>
						<view class="j-w-card-column-bottom">待取衣</view>
						<view class="j-w-card-column-badge" v-if="orderMallCount.waitputGoods">
							{{orderMallCountNum(orderMallCount.waitputGoods )}}
						</view>
					</view>
					<view class="j-w-card-column" @click="toMeOrder(2)">
						<view class="j-w-card-column-top">
							<view class="j-w-card-column-top-img">
								<image src="../../static/image/j-m-o-4.png"></image>
							</view>
						</view>
						<view class="j-w-card-column-bottom">洗护中</view>
						<view class="j-w-card-column-badge" v-if="orderMallCount.waitbackGoods">
							{{orderMallCountNum(orderMallCount.waitbackGoods)}}
						</view>
					</view>
					<view class="j-w-card-column" @click="toMeOrder(3)">
						<view class="j-w-card-column-top">
							<view class="j-w-card-column-top-img">
								<image src="../../static/image/j-m-o-5.png"></image>
							</view>
						</view>
						<view class="j-w-card-column-bottom">已完成</view>
						<view class="j-w-card-column-badge" v-if="orderMallCount.waitComplete">
							{{orderMallCountNum(orderMallCount.waitComplete)}}
						</view>
					</view>
					<view class="j-w-card-column" @click="toMeOrder(4)">
						<view class="j-w-card-column-top">
							<view class="j-w-card-column-top-img">
								<image src="../../static/image/j-m-o-2.png"></image>
							</view>
						</view>
						<view class="j-w-card-column-bottom">已取消</view>
						<view class="j-w-card-column-badge" v-if="orderMallCount.waitClose">
							{{orderMallCountNum(orderMallCount.waitClose)}}
						</view>
					</view>
				</view>
			</view>
		</view>


		<!-- 		<view class="j-w-tool">
			<view class="j-w-card">
				<view class="j-w-card-nav">
					<view class="j-w-card-title">常用工具</view>
				</view>

				<view class="j-w-card-content1">
					<view class="j-w-card-column" @click="toMeAddress">
						<view class="j-w-card-column-top">

							<image style="width: 70rpx;
    height: 70rpx;" src="../../static/image/位置.png" mode=""></image>
						</view>
						<view class="j-w-card-column-bottom">收货地址</view>
					</view>
					<view class="j-w-card-column" @click="toMeInfo">
						<view class="j-w-card-column-top">
							<image style="width: 70rpx;
							height: 70rpx;" src="../../static/image/购物车.png" mode=""></image>

						</view>
						<view class="j-w-card-column-bottom">购物车</view>
					</view>

				</view>
			</view>
		</view> -->


	</view>
</template>

<script>
	import {
		mapState
	} from 'vuex'
	export default {
		data() {
			return {
				orderMallCount: {},
				isRead: false,
				showSignInPopup: false,
				signInIntegral: 0,
				signIncheck: false,
			};
		},
		components: {

		},
		computed: {
			...mapState({
				isGetPhone: (state) => {
					return state.isGetPhone
				},
				userInfo: (state) => {
					return state.userInfo
				}
			})
		},
		onShow() {
			if (this.isGetPhone) {
				this.toLoginPage()
				return
			}
			// 商城订单-查询统计订单状态数量
			this.postFindOrderMallCount();
		},
		onLoad() {},
		methods: {
			toLoginPage() {
				uni.reLaunch({
					url: '/pages/login'
				})
			},
			// 商城订单-查询统计订单状态数量
			postFindOrderMallCount() {
				this.$u.api
					.postFindOrderMallCount()
					.then(res => {
						console.log(res, '[我的页-查询统计订单状态数量]');
						this.orderMallCount = res.data;
					})
					.catch(err => {
						console.log(err);
						if (err.status == 401) {
							this.orderMallCount = {};
						}
					});
			},
			// 判断订单数据大于100的时候
			orderMallCountNum(num) {
				if (num > 99) {
					num = '99+';
				}
				return num;
			},

			// 跳转收货地址页面
			toMeAddress() {
				uni.navigateTo({
					url: './setting/address/address'
				});
			},
			// 跳转关于我们
			toMeAbout() {
				uni.redirectTo({
					url: '../index/pay-success/pay-success?orderType="配送"&price="111"'
				});
			},

			// 跳转购物车
			toMeInfo() {
				uni.navigateTo({
					url: './setting/me-info/me-info'
				});
			},
			// 跳转我的订单
			toMeOrder(index) {
				uni.setStorageSync('orderIndex', index);
				uni.switchTab({
					url: '/pages/order/order'
				});
			},
		}
	};
</script>

<style>
	page {
		background-color: #f3f3f3;
	}
</style>
<style scoped lang="scss">
	.j-a-warp {
		display: flex;
		align-items: center;
		justify-content: center;
		height: 100%;

		.j-a-popup {
			position: relative;
			width: 480rpx;
			height: auto;

			image {
				width: 100%;
			}

			.j-a-popup-info {
				position: absolute;
				bottom: 40rpx;
				left: 0;
				z-index: 1;
				width: 100%;
				display: flex;
				align-items: flex-end;
				justify-content: center;

				.j-a-integral {
					padding-bottom: 10rpx;
				}

				.j-a-add {
					color: #e9b119;
					font-size: 40rpx;
					font-weight: bold;
					margin-left: 8rpx;
					padding-bottom: 2rpx;
				}

				.j-a-num {
					color: #e9b119;
					font-size: 50rpx;
					font-weight: bold;
					margin-left: 4rpx;
				}
			}
		}

	}

	.j-w-card {
		background: #ffffff;
		border-radius: 14px;
		padding-bottom: 40rpx;

		.j-w-card-nav {
			display: flex;
			align-items: center;
			padding: 33rpx 22rpx;
			justify-content: space-between;

			.j-w-card-title {
				color: #121212;
				font-weight: bold;
			}

			.j-w-card-jump {
				display: flex;
				color: #aaaaaa;
				font-size: 22rpx;
				align-items: center;

				.hxf {
					color: #aaaaaa;
					font-size: 28rpx;
					padding-top: 8rpx;
				}
			}
		}

		.j-w-card-content {
			display: flex;
			padding-bottom: 33rpx;
			align-items: center;
			justify-content: space-around;

			.j-w-card-column {
				display: flex;
				flex-direction: column;
				justify-content: center;
				align-items: center;
				position: relative;

				.j-w-card-column-badge {
					min-width: 18rpx;
					min-height: 30rpx;
					padding: 0 6rpx;
					border-radius: 25rpx;
					text-align: center;
					line-height: 30rpx;
					color: #FFFFFF;
					background-color: red;
					position: absolute;
					top: -16rpx;
					right: -10rpx;
					font-size: 22rpx;
				}

				.j-w-card-column-top {
					.hxf {
						font-size: 42rpx;
						color: #333333;
					}

					.j-w-card-column-top-img {
						width: 44rpx;
						height: 44rpx;
						position: relative;

						image {
							width: 100%;
							height: 100%;
						}
					}

					.j-w-card-column-top-bold-text {
						font-size: 35rpx;
						font-weight: bold;
					}
				}

				.j-w-card-column-bottom {
					color: #4f4f4f;
					font-size: 25rpx;
				}
			}
		}

		.j-w-card-content1 {
			// display: flex;
			// padding-bottom: 33rpx;
			// align-items: center;
			// justify-content: space-around;

			.j-w-card-column {
				// display: flex;
				// flex-direction: column;
				// justify-content: center;
				// align-items: center;
				// position: relative;
				width: 25%;
				text-align: center;
				display: inline-block;

				.j-w-card-column-badge {
					min-width: 18rpx;
					min-height: 30rpx;
					padding: 0 6rpx;
					border-radius: 25rpx;
					text-align: center;
					line-height: 30rpx;
					color: #FFFFFF;
					background-color: red;
					position: absolute;
					top: -16rpx;
					right: -10rpx;
					font-size: 22rpx;
				}

				.j-w-card-column-top {
					.hxf {
						font-size: 42rpx;
						color: #333333;
					}

					.j-w-card-column-top-img {
						width: 44rpx;
						height: 44rpx;
						position: relative;

						image {
							width: 100%;
							height: 100%;
						}
					}

					.j-w-card-column-top-bold-text {
						font-size: 35rpx;
						font-weight: bold;
					}
				}

				.j-w-card-column-bottom {
					color: #4f4f4f;
					font-size: 25rpx;
				}
			}
		}
	}

	.j-w-me {
		.j-w-vip {
			padding: 0 28rpx;

			.j-w-vip-l {
				display: flex;
				justify-content: space-between;
				margin-top: -68rpx;
				height: 140rpx;
				line-height: 96rpx;
				padding: 0 32rpx;
				// background: url(../../static/image/me/j-m-v-bg.png) no-repeat 100% 100%;
				// background-size: 100% 100%;

				.j-w-vip-text {
					width: 224rpx;
					height: 70rpx;
					margin-top: 38rpx;

					image {
						width: 100%;
						height: 100%;
					}
				}

				.j-w-vip-btn {
					display: flex;
					align-items: center;

					.j-w-vip-m {
						color: #897a5b;
						font-size: 22rpx;
						margin-right: 15rpx;
					}

					.j-w-vip-b {
						color: #040000;
						width: 166rpx;
						height: 60rpx;
						font-size: 28rpx;
						font-weight: bold;
						padding-top: 4rpx;
						background: linear-gradient(90deg,
								rgba(253, 223, 199, 1),
								rgba(254, 224, 200, 1),
								rgba(247, 216, 188, 1),
								rgba(249, 213, 181, 1),
								rgba(245, 205, 170, 1),
								rgba(243, 199, 164, 1));

						&::after {
							border: 0;
						}
					}
				}
			}
		}

		.j-w-head {
			height: 265rpx;

			// background: linear-gradient(90deg, rgba(254, 208, 0, 1), rgba(254, 189, 0, 1));
			.j-w-head-img {
				position: absolute;
				top: 0;
				width: 100vw;
				z-index: -1;
			}

			.j-w-user-o-warp {
				display: flex;
				padding: 14rpx 28rpx;
				justify-content: flex-end;
			}

			.j-w-user-o {
				display: flex;
				width: 120rpx;
				justify-content: space-between;

				.j-w-user-icon {
					padding-top: 14rpx;
					position: relative;
					width: 40rpx;
					height: 40rpx;

					.j-w-read {
						width: 12rpx;
						height: 12rpx;
						background-color: red;
						border-radius: 50%;
						position: absolute;
						top: 6rpx;
						right: 0rpx;
					}

					.hxf {
						color: #333333;
						font-size: 35rpx;
					}
				}
			}

			.j-w-user {
				display: flex;
				padding: 0 28rpx;
				align-items: center;
				margin-top: 5vh;

				.j-w-user-q {
					width: 70rpx;
					height: 90rpx;

					image {
						width: 100%;
						height: 100%;
					}
				}

				.j-w-user-i {
					flex: 1;
					display: flex;
					align-items: center;

					.j-w-user-image {
						width: 110rpx;
						height: 110rpx;
						border-radius: 50%;
						overflow: hidden;

						image {
							width: 100%;
							height: 100%;
						}
					}

					.j-w-user-d {
						display: flex;
						margin-left: 18rpx;
						flex-direction: column;

						.j-w-user-nickname {
							color: #121212;
							font-size: 30rpx;
							font-weight: bold;
						}

						.j-w-user-vip {
							display: flex;
							margin-top: 10rpx;
							align-items: center;

							.j-w-user-tag {
								color: #2c1e03;
								height: 36rpx;
								line-height: 36rpx;
								display: flex;
								font-size: 23rpx;
								border-radius: 17rpx;
								margin-right: 13rpx;
								padding: 0 14rpx;
								display: flex;
								align-items: center;
								background-color: #e9b119;

								&:last-of-type {
									margin-right: 0;
								}

								.hxf-youbian {
									margin-left: 5rpx;
									margin-top: 5rpx;
									color: #2c1e03;
									font-size: 24rpx;
								}
							}
						}
					}
				}
			}
		}

		.j-w-order {
			padding: 0 28rpx;
			margin-top: 22rpx;
		}

		.j-w-wallet {
			padding: 0 28rpx;
			margin-top: 22rpx;
		}

		.j-w-tool {
			padding: 0 28rpx;
			margin-top: 22rpx;
		}
	}

	.user-header {
		display: flex;
		align-items: center;
		padding: 30rpx;
		margin: 30rpx 24rpx;
		background-color: #ffffff;
		border-radius: 30rpx;

		.j-w-user-nickname {
			font-size: 36rpx;
			font-weight: 900;
			margin-left: 30rpx;
		}

		&-img {
			width: 100rpx;
			height: 100rpx;
			background-color: #3D9C9A;
			display: flex;
			align-items: center;
			justify-content: center;
			border-radius: 50rpx;
		}
	}
</style>